<template lang="html">
  <Actionsheet v-model="show" :menus="menus" @on-click-menu-do="doFn" @on-click-menu-cancel="cancel" @on-click-mask="cancel" />
</template>

<script>
import { mapGetters } from 'vuex'
import copy from 'copy-to-clipboard'
import { Actionsheet } from 'vux'

export default {
  data () {
    return {
      menus: {
        do: '复制此新闻链接',
        cancel: '取消'
      }
    }
  },
  computed: {
    ...mapGetters({
      shareShow: 'shareShow',
      shareLink: 'shareLink'
    }),
    show: {
      get () {
        return this.shareShow
      },
      set () {}
    }
  },
  methods: {
    doFn () {
      copy(this.shareLink)
      this.$vux.toast.text('复制成功')
      this.cancel()
    },
    cancel () {
      this.$store.commit('hideShare')
    }
  },
  components: {
    Actionsheet
  }
}
</script>

<style lang="css">
</style>
